package design_pattern.ThreadPerMessage;

import org.springframework.validation.beanvalidation.SpringValidatorAdapter;

import java.util.stream.IntStream;

/**
 * @Author: 蔡翔
 * @Date: 2019/11/18 9:06
 * @Version 1.0
 */
public class PerThreadClient {

    public static void main(String[] args) {
        final MessageHandler messageHandler = new MessageHandler();
        IntStream.rangeClosed(1,10)
                .forEach(i->{
                    messageHandler.request(new Message(String.valueOf(i)));
                });
        //要给线程池给停了，不然main线程不会结束。
        messageHandler.shutdown();
    }
}
